package com.neuedu.method;

import java.util.Scanner;

public class Homework01 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数");
        int number = sc.nextInt();
        System.out.println("这个数的阶乘为"+factorial(number));
    }

    public static double factorial(int num){
        //1乘任何数都等于它本身
        double factorial = 1;
        for (int i = 1; i <= num; i++) {
            factorial=factorial*i;
        }
        return factorial;
    }
}
